home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 23 / CU Amiga - Super CD-ROM 23 (June 1998).iso / CUCD / Programming / AMOSList / AMOSLIST / text0321.txt < prev    next >
Encoding:
Text File  |  1998-04-01  |  2.9 KB  |  77 lines

  1. On 27-Mar-98, Lee wrote:
  2.  
  3. >inparticular) I thought I would write Amos Robots.
  4. >Is there any interest?
  5.  
  6. Long time ago I actually made something likewise in AMOS.
  7. The program is very badly documented and it's long time since I made it, so
  8. I'll probably use some time on remembering what it is all about...
  9.  
  10. But there is some sort of board with some robots on.
  11. The robots can read data about all the robots and about the board (The board
  12. is a 2D array, where 0 means open floor, -1 means wall, and >0 means robot
  13. number N (the robot itself has number one))
  14.  
  15. The arrays:
  16. BOARD(,): the board (commented above)
  17. RX(): Robot x-coord
  18. RY(): Robot y-coord
  19. RDIR(): Robot direction (0:right, 1:down, 2:left, 3:up)
  20. RENE(): Robot Energy (0:dead, 10:as healthy as can be)
  21. NAME$(): The name of the robot (can't be changed after start)
  22.  
  23. Global variables:
  24. KOM$: The robots can use this variable to "talk" (that is: write comments on
  25. the screen. If they put anything in this string, then the string will be
  26. printed after the robot hasa returned)
  27. NUM: Number of robots
  28. WX: Width of board
  29. WY: Heigth of board
  30. SR: Status register. This is the only changeable variable that will be
  31. reserved from call to call. Use it for whatever you want.
  32.  
  33. The robot programs are included into procedures, so it is illegal to make
  34. procedures in you programs (as it is illegal to have procedures nested into
  35. each other)
  36.  
  37. The procedure returns:
  38.  
  39. -2: Shoot (if there is a robot in front, then the robot will loose one
  40. energy-point)
  41. -1: Walk (Walks one step forwards. If there is a wall then nothing. If there
  42. is a  robot in front then the robot is pushed (moved along))
  43. 0: Nop
  44. >0: Add N to RDIR (that is: 1:turn right ; 2:U-turn ; 3:turn left)
  45.  
  46. First time the procedure is called then RX(1)=-1. Then the robot shall not do
  47. its move. Instead it shall return it's name...
  48.  
  49. A robot program can look something like this:
  50.  
  51. If RX(1)=-1 : Pop Proc["C0000L ROBOT"] : End If
  52. X=RX(1) : Y=RY(1) : DIR=RDIR(1) : ENERGY=RENEa(1)
  53. ( find out what to return here )
  54. Pop Proc[RETURN_VALUE]
  55.  
  56. The gfx havent been made yet, so we are talking block gfx, and the game needs
  57. overall finish.
  58. Included a little screen shot :) (all robots are controlled by the same
  59. program: "Lemmus Opus #1")
  60. But it sure is playable :)
  61. If you are interrested then I'll spend some time on commenting it and  posting
  62. it here...
  63. I think that I've mentioned all the rules above. But if there's nothing that's
  64. not clear, then let me know!
  65.  
  66. -- 
  67.  
  68.          /¯\ __    __ /¯¯¯¯¯\           _         Rune Zedeler
  69. ________/ /// \\__/ \\\  ---/           \¯-_      Peter Rørdams Vej 19
  70. \      / //¯|  \\/  ||¯\ \\¯¯¯¯¯¯¯¯¯¯¯¯¯¯   ¯-_   2800 Lyngby
  71.  )    / //  | \ ` / ||  \ \\ Lemmus of Efreet  -  Denmark
  72. /    / ¯¯¯¯¯\\|\-'/ /¯¯¯¯¯ \\____________   _-¯
  73. ¯¯¯¯¯\------'/||¯¯| \------'/           /_-¯      rzedeler@post10.tele.dk
  74.       ¯¯¯¯¯¯\-'/  \-'/¯¯¯¯¯¯            ¯         Tel: +45-45871730
  75.              ¯¯    ¯¯
  76.  
  77.